package com.vaca.myapplication;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AbstractBleActivity {
    private KeyboardPeripheral keyboard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void setupBlePeripheralProvider() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
            keyboard = new KeyboardPeripheral(this,this);
        }
        keyboard.setDeviceName("fuckyou");
        keyboard.startAdvertising();
        Log.e("fuck", "fuckyou");
    }

    @Override
    protected void onDestroy() {
        keyboard.stopAdvertising();
        super.onDestroy();
    }

    // 注意：Java中没有直接的等价物来替换Kotlin的函数类型参数，因此这里将view参数保留，但不使用。
    public void fuck(View view) {
        Log.d("fuck","发送文本");
        keyboard.sendKeys("fuckyou");
    }
}